<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <meta name="variant" content="">
  <meta name="variant" content="?keep-promise">
  <title>idlharness: namespace operation</title>
  <script src="../../../../variants.js"></script>
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <script src="/resources/WebIDLParser.js"></script>
  <script src="/resources/idlharness.js"></script>
</head>
<body>
<p>Verify the series of sub-tests that are executed for namespace operations.</p>
<script>
"use strict";

Object.defineProperty(self, "foo", {
  value: Object.defineProperty({}, "Truth", {
    value: function() {},
    writable: true,
    enumerable: true,
    configurable: true,
  }),
  writable: true,
  enumerable: false,
  configurable: true,
});

Object.defineProperty(self, "bar", {
  value: Object.defineProperty({}, "Truth", {
    value: function() {},
    writable: false,
    enumerable: true,
    configurable: false,
  }),
  writable: true,
  enumerable: false,
  configurable: true,
});

Object.defineProperty(self, "baz", {
  value: {
    LongStory: function(hero, ...details) {
      return `${hero} went and ${details.join(', then')}`
    },
    ShortStory: function(...details) {
      return `${details.join('. ')}`;
    },
  },
  writable: true,
  enumerable: false,
  configurable: true,
});

var idlArray = new IdlArray();
idlArray.add_idls(`
[Exposed=Window]
namespace foo {
  void Truth();
  void Lies();
};
[Exposed=Window]
namespace bar {
  [LegacyUnforgeable]
  void Truth();
};
[Exposed=Window]
namespace baz {
  DOMString LongStory(any hero, DOMString... details);
  DOMString ShortStory(DOMString... details);
};`);
idlArray.test();
</script>
<script type="text/json" id="expected">
{
  "summarized_status": {
    "status_string": "OK",
    "message": null
  },
  "summarized_tests": [
    {
      "name": "foo namespace: extended attributes",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "foo namespace: property descriptor",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "foo namespace: [[Extensible]] is true",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "foo namespace: [[Prototype]] is Object.prototype",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "foo namespace: typeof is \"object\"",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "foo namespace: has no length property",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "foo namespace: has no name property",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "foo namespace: operation Truth()",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "foo namespace: operation Lies()",
      "status_string": "FAIL",
      "properties": {},
      "message": "assert_own_property: namespace object missing operation \"Lies\" expected property \"Lies\" missing"
    },
    {
      "name": "bar namespace: extended attributes",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "bar namespace: property descriptor",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "bar namespace: [[Extensible]] is true",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "bar namespace: [[Prototype]] is Object.prototype",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "bar namespace: typeof is \"object\"",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "bar namespace: has no length property",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "bar namespace: has no name property",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "bar namespace: operation Truth()",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },

    {
      "name": "baz namespace: extended attributes",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "baz namespace: property descriptor",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "baz namespace: [[Extensible]] is true",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "baz namespace: [[Prototype]] is Object.prototype",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "baz namespace: typeof is \"object\"",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "baz namespace: has no length property",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "baz namespace: has no name property",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "baz namespace: operation LongStory(any, DOMString...)",
      "status_string": "PASS",
      "properties": {},
      "message": null
    },
    {
      "name": "baz namespace: operation ShortStory(DOMString...)",
      "status_string": "PASS",
      "properties": {},
      "message": null
    }
  ],
  "type": "complete"
}
</script>
</body>
</html>
